﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="cakeByTag.aspx.vb" Inherits="diy_wc_prototype.cakeByTag" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   
       <div class="gvLeft">
        <h3>
            Quick filter by tag:</h3><br />
        <asp:DropDownList ID="ddl_tags" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource4"
            DataTextField="tag" DataValueField="tag" AppendDataBoundItems="True">
              <asp:ListItem Text="Please select" Value="" />   
        </asp:DropDownList>
           <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
               ConnectionString="<%$ ConnectionStrings:diycakeConnectionString %>" 
               ProviderName="<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>" 
               SelectCommand="SELECT DISTINCT [tag] FROM [tag]"></asp:SqlDataSource>
        <br />
        <br />Filtered by:
           <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource3">
               <ItemTemplate>
                   <asp:Label ID="tagLabel" runat="server" Text='<%# Eval("tag") %>' />
               </ItemTemplate>
               <EmptyDataTemplate>Not yet filtered</EmptyDataTemplate>          
           </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:diycakeConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>" 
            SelectCommand="SELECT DISTINCT [tag] FROM [tag] WHERE ([tag] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="tag" QueryStringField="tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
            AllowSorting="True" GridLines="Horizontal" Width="920px" BorderStyle="None">
       <Columns>
                <asp:ImageField DataImageUrlField="cakeImg1" SortExpression="cakeImg1">
                    <ItemStyle CssClass="profilePic" />
                </asp:ImageField>
                <asp:BoundField DataField="cakeType" HeaderText="Type" SortExpression="cakeType" />
                <asp:BoundField DataField="cakeYr" HeaderText="Year" SortExpression="cakeYr" />
                <asp:TemplateField HeaderText="Difficulty" SortExpression="cakeDifficulty">
                    <ItemTemplate>
                        <%# getDifficulty(Eval("cakeDifficulty"))%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Rating" SortExpression="cakeStar" ItemStyle-CssClass="stars">
                    <ItemTemplate>
                        <%# getStars(Eval("cakeStar"))%></ItemTemplate>
                    <ItemStyle CssClass="stars"></ItemStyle>
                </asp:TemplateField>
                <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="cakeProfile.aspx?ID={0}"
                    Text="More" />
            </Columns>
            <HeaderStyle BackColor="#666666" BorderStyle="None" ForeColor="White" Height="40px"
                HorizontalAlign="Left" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>

   
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:diycakeConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>" 
        
               SelectCommand="SELECT DISTINCT * FROM cakeTagViewAll WHERE tag=?">
        <SelectParameters>
            <asp:QueryStringParameter Name="?" QueryStringField="tag" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div>
</asp:Content>
